﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RuleCode.Common
{
    public static class Info
    {
        /// <summary>
        /// 把DialogResult 类型转化为 InfoResult 类型
        /// </summary>
        /// <param name="dialog"></param>
        /// <returns></returns>
        public static InfoResult ConvertDialogToInfo(DialogResult dialog)
        {
            switch (dialog)
            {
                case DialogResult.OK:
                        return InfoResult.OK;
                case DialogResult .Cancel :
                        return InfoResult.Cancel;
                case DialogResult.Yes:
                        return InfoResult.Yes;
                case DialogResult .No :
                        return InfoResult.No;
                case DialogResult .Abort :
                        return InfoResult.Abort;
                case DialogResult .Ignore :
                        return InfoResult.Ignore;
                case DialogResult .Retry :
                        return InfoResult.Retry;
                default :
                        return InfoResult.OK;
            }
        }

        public static InfoResult Show(string text)
        {
            //if (CurrentUser.RunState == RunState.Form)
            //{
            //    return ConvertDialogToInfo(MessageBox.Show(text));
            //}
            //else
            //{
            //    return InfoResult.OK;
            //}
            return InfoResult.OK;
        }

        public static InfoResult Show(string text,string caption)
        {
            //if (CurrentUser.RunState == RunState.Form)
            //{
            //    return ConvertDialogToInfo(MessageBox.Show(text, caption));
            //}
            //else
            //{
            //    return InfoResult.OK;
            //}
            return InfoResult.OK;
        }

        public static InfoResult Show(string text, string caption,MessageBoxButtons buttons)
        {
            //if (CurrentUser.RunState == RunState.Form)
            //{
            //    return ConvertDialogToInfo(MessageBox.Show(text, caption,buttons));
            //}
            //else
            //{
            //    return InfoResult.OK;
            //}
            return InfoResult.OK;
        }
    }

    public enum InfoResult
    {
        OK=0,

        Cancel,

        Yes,

        No,

        Abort,

        Ignore,

        Retry
    }
}
